package com.design.策略模式;

public class ContextM<T> {

	private Strategy strategy;
	
	public ContextM(Class<?> cls){
		if(cls.getName().equals(IntegerConvert.class.getName())) {
			strategy =  new IntegerConvert();
		}else if(cls.getName().equals(LongConvert.class.getName())) {
			strategy =  new LongConvert();
		}else{
			strategy =  new StrUpperConvert();
		}
	}
	
	public T convert(String str) {
		return (T) strategy.convert(str);
	}
	
}
